From: Jo-Philipp Wich Date: Mon, 27 Feb 2017 22:23:59 +0000 (+0100) Subject: opkg_cmd: avoid null pointer dereference in opkg_what_depends_conflicts_cmd() X-Git-Url: http://git.openwrt.org/%22https:/collectd.org///%22https:/collectd.org/?a=commitdiff_plain;h=15fc1ee4115e465fc2e5c839d1e290e7dde70533;p=project%2Fopkg-lede.git opkg_cmd: avoid null pointer dereference in opkg_what_depends_conflicts_cmd() Signed-off-by: Jo-Philipp Wich --- diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c index d0d2877..543eef4 100644 --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c @@ -1033,7 +1033,7 @@ opkg_what_depends_conflicts_cmd(enum depend_type what_field_type, int recursive, deps = pkg_get_ptr(pkg, (what_field_type == CONFLICTS) ? PKG_CONFLICTS : PKG_DEPENDS); - for (cdep = deps; cdep->type; cdep++) { + for (cdep = deps; cdep && cdep->type; cdep++) { if (what_field_type != cdep->type) continue;